package com.wujp.common.template.tools.utils;

import java.io.*;

public class FileUtil {

    public static String readFile(File tmpfile) throws IOException {

        StringBuilder sb = new StringBuilder();
        InputStreamReader reader = null;
        BufferedReader bf = null;
        try {
            reader = new InputStreamReader(new FileInputStream(tmpfile));
            bf = new BufferedReader(reader);

            String line;
            while ((line = bf.readLine()) != null) {

                if (line.trim().length() == 0) {
                    continue;
                }
                sb.append(line.trim());
            }
        } finally {

            if (reader != null) {
                reader.close();
            }
            if (bf != null) {
                bf.close();
            }
        }

        return sb.toString();
    }

}
